import { createStore } from "vuex";

// https://webpack.js.org/guides/dependency-management/#requirecontext
const modulesFiles = import.meta.globEager("./modules/*.js");
console.log(typeof modulesFiles);

let modules = [];
for (const path in modulesFiles) {
  const moduleName = path.replace(/^\.\/(.*)\.\w+$/, "$1");
  const value = modulesFiles[path];
  modules[moduleName] = value.default;
}

const store = createStore({
  modules,
});

export default store;
